package leetcode;

import java.util.HashMap;
import java.util.Map;

public class CountDigits {
    public static void main(String[] args) {
        CountDigits countDigits = new CountDigits();
        System.out.println(countDigits.countDigits(7));
    }

    public int countDigits(int num) {
        int ans = 0;
        int temp = num;
        while (temp >= 1) {
            int a = temp % 10;
            if (num % a == 0) {
                ans++;
            }
            temp /= 10;
        }
        return ans;
    }
}
